﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TryUser.ascx.cs" Inherits="Controls_TryUser" %>


<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
    <div class="moduletable userinfo">
        <h3>Welcome!</h3>
        <div class="mt-content">
            You are not logged in.
            <br />
            <asp:HyperLink ID="lnkLoginStatus" runat="server" Text="Log In"
            NavigateUrl="~/Login.aspx" />
        or 
            <asp:HyperLink NavigateUrl="~/Register.aspx" ID="lnkRegister"
            runat="server" Text="Register"
            ToolTip="Go to the register page" />
        </div>
    </div>
</AnonymousTemplate>
<RoleGroups>
    <asp:RoleGroup Roles="Administrators">
        <ContentTemplate>
            <div class="moduletable userinfo">
                <h3>
                    <asp:LoginName ID="LoginName1" FormatString="Hello, {0}!"
                    runat="server" />
                    
                </h3>
                <div class="mt-content">
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" 
                        ProviderName="System.Data.SqlClient" 
                        SelectCommand="SELECT [Email] FROM [vw_aspnet_MembershipUsers] WHERE ([UserName] = @UserName)">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="panda1233" Name="UserName" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    <asp:HyperLink ID="lnkLogout" runat="server" Text="Logout"
                    NavigateUrl="~/Login.aspx" /> &nbsp;
                    <asp:HyperLink ID="HyperLink2"
                    NavigateUrl="~/CustomerDetails.aspx" Text="Edit Details"
                    ToolTip="Edit your personal details" runat="server" />
                    <br />
                    <asp:HyperLink ID="HyperLink1" NavigateUrl="~/Admin"
                    Text="Administrator" runat="server" />
                </div>
            </div>
        </ContentTemplate>
    </asp:RoleGroup>
    <asp:RoleGroup Roles="Customers">
    <ContentTemplate>
        <div class="moduletable userinfo">
            <h3>
                <asp:LoginName ID="LoginName1" FormatString="Hello, {0}!"
                runat="server" />
            </h3>
            <div class="mt-content">
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" 
                        ProviderName="System.Data.SqlClient" 
                        SelectCommand="SELECT [Email] FROM [vw_aspnet_MembershipUsers] WHERE ([UserName] = @UserName)">
                        <SelectParameters>
                            <asp:ProfileParameter DefaultValue="admin" Name="UserName" 
                                PropertyName="LoginName1" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                <asp:HyperLink ID="lnkLogout" runat="server" Text="Logout"
                NavigateUrl="~/Login.aspx" /> &nbsp;
                <asp:HyperLink ID="HyperLink2"
                NavigateUrl="~/CustomerDetails.aspx" Text="Edit Details"
                ToolTip="Edit your personal details" runat="server" />
            </div>
        </div>
    </ContentTemplate> 
    </asp:RoleGroup> 
</RoleGroups>
</asp:LoginView>